import com.live5.liveplayer.MediaPlayer;
import com.live5.liveplayer.Playlist;
import mx.utils.Delegate;
class com.live5.liveplayer.FlvPlayer extends MediaPlayer
{
	var streamObject:NetStream;
	var conn:NetConnection;
	function FlvPlayer()
	{
		MediaType="video/x-flv";
		conn = new NetConnection();
		conn.connect(null);
		streamObject =new NetStream(conn);
		
	}
	function OnVideoStatus(info){
		//for( var i in info){
			//trace (i+":" + info[i]);
		//}
		
		if(info["code"]=="NetStream.Play.Stop"){
			trace("video stoped");
			this.OnComplete();
		}
	}
	function DoPlay(){
		super.DoPlay();
		trace("flv play");
		Canvas.VideoObj.attachVideo(streamObject);
		streamObject.play(this.playlist.Current.Location);
		streamObject.onStatus = Delegate.create(this,OnVideoStatus);
	}
	function Stop(){
		trace("flv stop");
		streamObject.close();
	}
	function Pause(){
		super.Pause();
		trace("flv pause");
		streamObject.pause();
	}
}
